package com.example.backadmindemo.service.impl;

import com.example.backadmindemo.mapper.LabelMapper;
import com.example.backadmindemo.pojo.CustInfo;
import com.example.backadmindemo.pojo.Label;
import com.example.backadmindemo.service.LabelService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class LabelServiceImpl implements LabelService {
    @Resource
    private LabelMapper labelMapper;

    @Override
    public List<Label> select(int currentPage, int pageSize) {
        Map<String, Object> map = new HashMap<>();
        int startCurrentPage = (currentPage - 1) * pageSize;
        map.put("currentPage", startCurrentPage);
        map.put("pageSize", pageSize);
        return labelMapper.select(map);
    }

    @Override
    public List<Label> selectGoal(int currentPage, int pageSize) {
        Map<String, Object> map = new HashMap<>();
        int startCurrentPage = (currentPage - 1) * pageSize;
        map.put("currentPage", startCurrentPage);
        map.put("pageSize", pageSize);
        return labelMapper.selectGoal(map);
    }


    @Override
    public Integer getSelect() {
        return labelMapper.getSelect();
    }

    @Override
    public Integer getSelectGoal() {
        return labelMapper.getSelectGoal();
    }

    @Override
    public void setGoal(int id) {
        labelMapper.setGoal(id);
    }

    @Override
    public void cancelGoal(int id) {
        labelMapper.cancelGoal(id);
    }
}
